<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateIssuesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('issues', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('member_id')->unsigned()->comment('用户 ID')->index();
            $table->integer('goods_id')->unsigned()->comment('商品 ID')->index();
            $table->string('content')->comment('咨询内容');
            $table->integer('reply_id')->unsigned()->nullable()->comment('回复 ID')->index();
            $table->boolean('replied')->default(false)->comment('是否已回复，该值用作缓存查询');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('issues');
    }
}
